import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/index',
    children:[
      {
        path:'/index',
        component:() => import('../views/home/HomeIndexView.vue')
      },
      {
        path:'/reg',
        component:() => import('../views/home/RegView.vue')
      },
      {
        path:'/login',
        component:() => import('../views/home/LoginView.vue')
      },
      {
        path:'/personal',
        component:() => import('../views/home/PersonalView.vue'),
        redirect:'/index',
        children:[
          {
            path:'index',
            component:() => import('../views/home/personal/PersonalIndexView.vue')
          },
          {
            path:'orders',
            component:() => import('../views/home/personal/OrdersView.vue')
          }
        ]
      },
      {
        path:'/filmIndex',
        component:() => import('../views/home/FilmIndexView.vue')
      },
      {
        path:'/filmDetail',
        component:() => import('../views/home/FilmDetailView.vue'),
        children: [
          {
            path: 'atlas',
            component: ()=> import('../views/home/cinemadetail/AtlasView.vue')

          },
          {
            path: 'introduce',
            component:() => import('../views/home/cinemadetail/IntroduceView.vue')
          },
          {
            path: 'job',
            component:()=> import('../views/home/cinemadetail/JobView.vue')
          },
          {
            path: 'prizes',
            component:()=> import('../views/home/cinemadetail/PrizesView.vue')
          }
        ]
      },
      {
        path:'/cinemaIndex',
        component:() => import('../views/home/CinemaIndexView.vue')
      },
      {
        path:'/cinemaDetail',
        component:() => import('../views/home/CinemaDetailView.vue')
      },
      {
        path:'/seats',
        component:() => import('../views/home/SeatsView.vue')
      },
      {
        path:'/payment',
        component:() => import('../views/home/PaymentView.vue')
      },

    ]
  },

  {
    path:'/adminlogin',
    component:() => import('../views/home/admin/AdminLoginView.vue')
  },
  {
    path:'/admin',
    component:() => import('../views/AdminView.vue'),
    children: [
      {
        path:'CIM',
        component:() => import('../views/home/admin/CinemaInformationManagementView.vue')
      },
      {
        path:'index',
        component:() => import('../views/home/admin/AdminIndexView.vue')
      }
    ]
  },


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
